/**
 * 
 */
package leetCode;

/**
 * @author zhongfang
 *
 */
public class SumofSquareNumbers {
    public static boolean judgeSquareSum(int c) {
    	int max=(int)Math.sqrt(c);
    	for (int i = 0; i <= max; i++) {
			int tmp=c-i*i;
			int b=(int)Math.sqrt(tmp);
			if(b*b==tmp){
				return true;
			}
		}
        return false;
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(judgeSquareSum(5));
		System.out.println(judgeSquareSum(3));
	}

}
